<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ScrumScheduleEntry.aspx.cs" Inherits="ScrumScheduleEntry" Title="Tackle - Scrum Schedule Entry" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHolder" runat="Server">
    <span style="font-family: Verdana"><span style="font-size: 10pt"><strong>Scrum Schedule
        Entry<br />
    </strong>
        <br />
        <span style="font-size: 8pt">This page contains the details associated with the entire
            scrum schedule.</span><br />
        <br />
    </span>
        <asp:UpdatePanel runat="server" ID="UPGridView" UpdateMode="Conditional">
            <ContentTemplate>
<TABLE style="WIDTH: 98%" cellSpacing=0 cellPadding=4><TBODY><TR><TD style="BORDER-RIGHT: silver 1px ridge; BORDER-TOP: silver 1px ridge; BORDER-LEFT: silver 1px ridge; BORDER-BOTTOM: silver 1px ridge" bgColor=#e3eaeb><SPAN style="FONT-SIZE: x-small">Page size:</SPAN><STRONG> </STRONG><asp:DropDownList id="dlPageSize" runat="server" Font-Size="X-Small" Font-Names="Verdana" OnSelectedIndexChanged="dlPageSize_SelectedIndexChanged" AutoPostBack="True">
                                <asp:ListItem>10</asp:ListItem>
                                <asp:ListItem>25</asp:ListItem>
                                <asp:ListItem>50</asp:ListItem>
                                <asp:ListItem>100</asp:ListItem>
                                <asp:ListItem>All</asp:ListItem>
                            </asp:DropDownList> </TD></TR><TR><TD vAlign=top><asp:GridView id="gvScrumScheduleEntry" runat="server" ForeColor="#333333" Font-Size="X-Small" Font-Names="Verdana" OnPreRender="gvScrumScheduleEntry_PreRender" DataSourceID="dsScrumScheduleEntry" OnRowDataBound="gvScrumScheduleEntry_RowDataBound" AllowPaging="True" OnRowDeleting="gvScrumScheduleEntry_RowDeleting" HorizontalAlign="Left" GridLines="None" DataKeyNames="MasterBacklogScheduleID" CellPadding="4" AutoGenerateColumns="False" AllowSorting="True" OnRowUpdated="gvScrumScheduleEntry_RowUpdated">
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" Font-Size="X-Small" />
                                <Columns>
                                    <asp:BoundField DataField="MasterBacklogScheduleID" HeaderText="ID" InsertVisible="False"
                                        ReadOnly="True" SortExpression="MasterBacklogScheduleID" Visible="False" />
                                    <asp:TemplateField HeaderText="Name" SortExpression="SprintName">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                                MaxLength="20" Text='<%# Bind("SprintName") %>' Width="106px"></asp:TextBox><asp:RequiredFieldValidator
                                                    ID="rfv1" runat="server" ControlToValidate="TextBox1" ErrorMessage="*?" ForeColor="LightCoral"
                                                    Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("SprintName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Theme" SortExpression="SprintTheme">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox2" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                                MaxLength="50" Text='<%# Bind("SprintTheme") %>' Width="120px"></asp:TextBox><asp:RequiredFieldValidator
                                                    ID="rfv2" runat="server" ControlToValidate="TextBox2" ErrorMessage="*?" ForeColor="LightCoral"
                                                    Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("SprintTheme") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Start Date" SortExpression="StartDate">
                                        <EditItemTemplate>
                                            <asp:Calendar ID="Calendar2" runat="server" Font-Names="Verdana" SelectedDate='<%# Bind("StartDate") %>'
                                                DayNameFormat="FirstTwoLetters" VisibleDate='<%# Eval("StartDate") %>'>
                                                <WeekendDayStyle BackColor="White" />
                                            </asp:Calendar>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("StartDate", "{0:d}") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
                                        <EditItemTemplate>
                                            <asp:Calendar ID="Calendar1" runat="server" Font-Names="Verdana" SelectedDate='<%# Bind("EndDate") %>'
                                                DayNameFormat="FirstTwoLetters" VisibleDate='<%# Eval("EndDate") %>'>
                                                <WeekendDayStyle BackColor="White" />
                                            </asp:Calendar>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("EndDate", "{0:d}") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Staff Count" SortExpression="Staff">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox5" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                                Text='<%# Bind("Staff") %>' Width="23px" OnPreRender="SetupOnFocus_PreRender"></asp:TextBox><asp:RequiredFieldValidator
                                                    ID="rfv5" runat="server" ControlToValidate="TextBox5" ErrorMessage="*?" ForeColor="LightCoral"
                                                    Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator><asp:RangeValidator
                                                        ID="rv5" runat="server" ControlToValidate="TextBox5" ErrorMessage="*#" ForeColor="LightCoral"
                                                        Font-Names="Verdana" Font-Size="Small" MaximumValue="10000" MinimumValue="0"
                                                        ToolTip="This field must contain a number between 0 and 10000" Type="Double"></asp:RangeValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("Staff") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Buffer" SortExpression="Buffer">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox6" runat="server" Font-Names="Verdana" Font-Size="X-Small"
                                                Text='<%# Bind("Buffer") %>' Width="30px" OnPreRender="SetupOnFocus_PreRender"></asp:TextBox><asp:RequiredFieldValidator
                                                    ID="rfv6" runat="server" ControlToValidate="TextBox6" ErrorMessage="*?" ForeColor="LightCoral"
                                                    Font-Names="Verdana" Font-Size="Small" ToolTip="This field must contain a valid value."></asp:RequiredFieldValidator><asp:RangeValidator
                                                        ID="rv6" runat="server" ControlToValidate="TextBox6" ErrorMessage="*#" ForeColor="LightCoral"
                                                        Font-Names="Verdana" Font-Size="Small" MaximumValue="10000" MinimumValue="0"
                                                        ToolTip="This field must contain a number between 0 and 10000" Type="Double"></asp:RangeValidator>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label6" runat="server" Text='<%# Bind("Buffer") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:CommandField ShowEditButton="True" />
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:LinkButton ID="linkButtonDelete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this record?');"
                                                CommandName="Delete">Delete</asp:LinkButton>
                                        </ItemTemplate>
                                        <ControlStyle ForeColor="Black" />
                                        <ItemStyle ForeColor="Black" />
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle BackColor="#E3EAEB" />
                                <EditRowStyle BackColor="#7C6F57" Font-Size="X-Small" VerticalAlign="Top" />
                                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" Font-Size="X-Small" />
                                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" Font-Size="X-Small" />
                                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <AlternatingRowStyle BackColor="White" />
                                <EmptyDataRowStyle Font-Size="X-Small" />
                            </asp:GridView> </TD></TR><TR><TD style="HEIGHT: 17px" colSpan=1><asp:Button id="btnNewSprint" onclick="btnNewSprint_Click" runat="server" Font-Size="X-Small" Text="New Sprint"></asp:Button> &nbsp; <asp:Label id="lblCantDelete" runat="server" ForeColor="Red" Font-Size="X-Small" Font-Names="Verdana" Text="The sprint cannot be modified as associated sprint items exists." Visible="False"></asp:Label></TD></TR></TBODY></TABLE>
</ContentTemplate>
        </asp:UpdatePanel>
    </span>
    <asp:SqlDataSource ID="dsScrumScheduleEntry" runat="server" ConnectionString="<%$ ConnectionStrings:TackleConnectionStringMain %>"
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT MasterBacklogScheduleID, fScrumTeamID, SprintName, SprintTheme, StartDate, EndDate, Staff, Buffer FROM tblMasterBacklogSchedule WHERE (fScrumTeamID = @ScrumTeamID) ORDER BY StartDate DESC"
        UpdateCommand="UPDATE tblMasterBacklogSchedule SET SprintName = @SprintName, SprintTheme = @SprintTheme, StartDate = @StartDate, EndDate = @EndDate, Staff = @Staff, Buffer = @Buffer WHERE (MasterBacklogScheduleID = @original_MasterBacklogScheduleID) "
        DeleteCommand="DELETE FROM tblMasterBacklogSchedule WHERE (MasterBacklogScheduleID = @original_MasterBacklogScheduleID)"
        InsertCommand="INSERT INTO tblMasterBacklogSchedule(SprintName, SprintTheme, StartDate, EndDate, Staff, Buffer, fScrumTeamID) VALUES (@SprintName, @SprintTheme, @StartDate, @EndDate, @Staff, @Buffer, @ScrumTeamID)">
        <UpdateParameters>
            <asp:Parameter Name="SprintName" />
            <asp:Parameter Name="SprintTheme" />
            <asp:Parameter Name="StartDate" />
            <asp:Parameter Name="EndDate" />
            <asp:Parameter Name="Staff" />
            <asp:Parameter Name="Buffer" />
            <asp:Parameter Name="MasterBacklogScheduleID" />
            <asp:Parameter Name="original_MasterBacklogScheduleID" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="MasterBacklogScheduleID" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="SprintName" />
            <asp:Parameter Name="SprintTheme" />
            <asp:Parameter Name="StartDate" />
            <asp:Parameter Name="EndDate" />
            <asp:Parameter Name="Staff" />
            <asp:Parameter Name="Buffer" />
            <asp:SessionParameter Name="ScrumTeamID" SessionField="ScrumTeamID" />
        </InsertParameters>
        <SelectParameters>
            <asp:SessionParameter Name="ScrumTeamID" SessionField="ScrumTeamID" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
